import { request } from '@/utils/request';
import Api from '@/core/permission/modules/org/depts';

export function getDeptsList(data) {
  return request({
    url: Api.list,
    method: 'post',
    data,
  });
}
/**
 * 获取人员所在的部门集合
 * @param data 
 * @returns 
 */
export function getDeptListByUser(data) {
  return request({
    url: '/api/orgm/getDeptListByUser',
    method: 'get',
    params:data,
  });
}
export function getDepartmentEntityList(){
  return request({
    url: Api.tree,
    method: 'get'
  });
}

export function createDept(data) {
  return request(
    {
      url: Api.add,
      method: 'post',
      data,
    }
  );
}

export function updateDept(data) {
  return request(
    {
      url: Api.update,
      method: 'post',
      data,
    }
  );
}

export function deleteDept(data: { id: number }) {
  return request({
    url: Api.delete,
    method: 'post',
    data,
  });
}

export function deptsUsers(data) {
  return request({
    url: '/api/orgm/getDeptUsers',
    method: 'post',
    data,
  });
}
